package com.example.administrator.yanfoxconn.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.administrator.yanfoxconn.R;
import com.example.administrator.yanfoxconn.bean.ActivityMsg;

import java.util.List;

/**
 * Created by S1007989 on 2021/05/21
 * Description：報名人員查詢列表
 */
public class ActBaoMingListAdapter extends BaseAdapter {
    public Context mContext;
    private List<ActivityMsg> lists;

    public ActBaoMingListAdapter(Context context, List<ActivityMsg> lists) {
        this.mContext = context;
        this.lists = lists;

    }

    @Override
    public int getCount() {
        return lists.size();
    }

    @Override
    public Object getItem(int position) {
        return lists.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final ViewHolder holder;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_act_list, null);
            holder.tvNum = (TextView)convertView.findViewById(R.id.tv_num);
            holder.tvCpc = (TextView)convertView.findViewById(R.id.tv_cpc);
            holder.tvDate = (TextView)convertView.findViewById(R.id.tv_date);
            holder.tvPosition = (TextView)convertView.findViewById(R.id.tv_position);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.tvNum.setText(""+(position+1));
        holder.tvCpc.setText(lists.get(position).getSign_code());
        holder.tvDate.setText(lists.get(position).getSign_name());
        holder.tvPosition.setText(lists.get(position).getSign_date().substring(0,16));

        return convertView;
        }

    private class ViewHolder{
        public TextView tvNum,tvCpc,tvDate,tvPosition,tvContent,tvPhone;
        LinearLayout  ll110;
    }

}
